package cn.secby.wms.util;

import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;

import java.util.Date;
import java.util.Map;

public class JwtTokenUtil {
 
    private static final String SECRET_KEY = "ABCDEFGHIJKLMN";

    /***
     * 生成令牌
     * @param dataMap
     * @return
     */
    public static String generate(Map<String,Object> dataMap) {
        return Jwts.builder()
                .addClaims(dataMap)
                .setExpiration(new Date(System.currentTimeMillis() + 864000000))
                .signWith(SignatureAlgorithm.HS512, SECRET_KEY)
                .compact();
    }
}